<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        background: url("./assets/jingling.png") no-repeat -186px -29px;
        width: 35px;
        height: 35px;
      }
    </style>
  </head>
  <body>
    <div></div>
    <button>点击我</button>
  </body>
  <script>
    const btn = document.querySelector("button");
    let timer = null;
    btn.addEventListener("click", () => {
      console.log(timer);
      if (timer) clearTimeout(timer);
      timer = setTimeout(() => {
        console.log(1);
      }, 1000);
    });
  </script>
</html>
